<?php

/*
  Project     : 48c6c450f1a4a0cc53d9585dc0fee742
  Created on  : Mar 16, 2013, 11:29:15 PM
  Author      : Truong Khuong - khuongxuantruong@gmail.com
  Description :
  Purpose of the stylesheet follows.
 */

class setting_model extends CI_Model {
    private $table;
    function __construct()
    {
        parent::__construct();
    }
    function get($_id){
        $query=$this->db
                ->where("conf_id",$_id)
                ->get("config");
        $error_number = $this->db->_error_number();
        $error_message = $this->db->_error_message();
        if($error_number!==0){
            $_SESSION['auth_db']['errors'][]=$error_message;
            return null;
        }
        $rs = $query->result();
        if(isset($rs[0]))   {
            return $rs[0];
        }
        return null;
    }
    function gets(){
        $query=$this->db
                ->get('config');
        $error_number = $this->db->_error_number();
        $error_message = $this->db->_error_message();
        if($error_number!==0){
            $_SESSION['auth_db']['errors'][]=$error_message;
            return null;
        }
        $rs = $query->result();
        return $rs;
    }
    function hash(){
        $configs=$this->gets();
        $tmp=null;
        if($configs)foreach ($configs as $c){
            $tmp[$c->conf_id]=$c->conf_value;
        }
        return $tmp;
    }
}

?>
